package com.eduask.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.eduask.beans.TicketSaled;
import com.eduask.dao.TicketSaledDAO;
import com.eduask.util.HibernateUtil;

@Repository
public class TicketSaledDAOImpl extends HibernateUtil implements TicketSaledDAO{

	@Override
	public void saveTicketSaled(TicketSaled ticketSaled) {
		getSession().save(ticketSaled);
	}

	@Override
	public void removeTicketSaled(TicketSaled ticketSaled) {
		getSession().delete(ticketSaled);
	}

	@Override
	public TicketSaled findTicketSaledById(Integer id) {
		return getSession().get(TicketSaled.class, id);
	}

	@Override
	public List<TicketSaled> findAllTicketSaled() {
		String hql = "from TicketSaled ticketSaled order by ticketSaled.id asc";
		return getSession().createQuery(hql).list();
	}
}
